<?php

namespace App\Http\Requests\Common\TagData\Image;

use App\Http\Requests\Request;

class VimgtagRequest extends Request
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        switch ($this->method()) {
            case 'GET':
            case 'DELETE':
                {
                    return [];
                }
            // Crate
            case 'POST':
                {
                    return [
                        'name'       => 'required|max:100',
                        'title'      => 'max:100',
                        'short_desc' => 'required|max:100',
                    ];
                }
            // UPDATE
            case 'PUT':
            case 'PATCH':
                {
                    // $id = $this->route('vimgtags');
                    return [
                        'name'       => 'required|max:100',
                        'title'      => 'max:100',
                        'short_desc' => 'required|max:100',
                    ];
                }
            default:
                break;
        }
    }
     public function messages()
    {
        return [
            'name.required'       => '名称 不能为空',
            'short_desc.required' => '简介 不能为空',
            'title.max'       => '标题 不能大于 :100',
        ];
    }
}
